<?php
    function get_proto()
    {
        return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")?"https://":"http://";
    }
    function get_lan()
    {
        return pop_value("lan",DEFAULT_LN);
    }
    //Look for GET,POST,SESSION , if value is storage on session , it will also delete it.
    function pop_value($key,$default=NULL)
    {
        if (isset($_GET) && array_key_exists($key,$_GET))
        {
            return $_GET[$key];
        }
        else if (isset($_POST) && array_key_exists($key,$_POST))
        {
            return $_POST[$key];
        }
        else
        {
        /*
            //session_start();
            if (isset($_SESSION[$key]))
            {
                $val = $_SESSION[$key];
                $_SESSION[$key] = NULL;
                //print_r($_SESSION);
                unset($_SESSION[$key]);
                session_unset();
                //session_write_close();
               // echo "Unset session " . $key;
               
                return $val;
            }
            else
            {
            */
                return $default;
            //}
        }
    }
    define("PAGE_SIZE",12);
    define("DEFAULT_LN","cn");
    //define("RES",base_path()."misc/res");
    define("RES",get_proto().$_SERVER["SERVER_NAME"]."/res");
    //define("CSS",base_path()."../res/css/");
    define("CSS",RES."/css/");
    define("JS",RES."/js/");
    define("IMG",RES."/img/");
    define("LANG",$_SERVER['DOCUMENT_ROOT']."/lang/");
    define("CERTAINSERVICE",9);
    define("MAP_ID","IFHq3oQ8LXXpLf2HO3jF");
    define("MAP_KEY","KATulAk4qA8HJf3wpruKhw");
    define("SLIDESHOWLEN",6);
    define("B2BHOST","http://180.169.67.50:3901");
    define("REQUESTTIMEOUT",60);
    define("FAILINTERVAl",30);
    define("MAXATTEMPT",10);
    define("EANCID","55505");
    define("EANKEY","ugxsbzbnp2kp8r5tw9vxg3uh");
    
    //print_r($_SERVER['REQUEST_URI']);
?>